import axios from "../utils/http";

const RulesStore = {
    namespaced:true,
    state:()=>({
        rules_list:[],
        zongshu:0
    }),
    mutations:{
        RulesMutations(state,list){
            state.rules_list=list
        },
        RulesMutationsZongshu(state,list){
            state.zongshu=list
        }
    },
    actions: {
      RulesActions(context,pages={page:1,size:1}){
          var url='/api/specslist?page='+pages.page+'&size='+pages.size
          axios.get(url).then(res=>{ 
              console.log(res);
              if(res.code==200){
                  context.commit('RulesMutations',res.list)
              }
          })
      },
    //   返回数据的条数
     RulesZongshu(context){
        axios.get('/api/specscount').then(res=>{
            if(res.code==200){
                console.log(res);
                context.commit('RulesMutationsZongshu',res.list[0].total)
            }
        })   
     }
    }
}
export default RulesStore